﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace WineStore.Models
{
    public class Product
    {
        public int ProductId { get; set; }

        [Required(ErrorMessage = "name is required !")]
        [MaxLength(50, ErrorMessage = "Name cannot be longer than 50 characters.")]
        public string ProductName { get; set; }

        [Required(ErrorMessage = "price is required !")]
        [DataType(DataType.Currency)]
        public decimal ProductPrice { get; set; }

        [Required(ErrorMessage = "date is required !")]
        [DataType(DataType.DateTime)]
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        public DateTime DateAdd { get; set; }

        [Required(ErrorMessage = "image is required !")]
        public string ProductImage { get; set; }

        [Required(ErrorMessage = "category is required !")]
        public int CategoryId { get; set; }

        public virtual Category Category { get; set; }
    }
}